package one.stand.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import one.stand.aop.ApiController;
import one.stand.exception.ParamException;
import one.stand.model.ResultModel;
import one.stand.request.essay.UpdateMyTaskFrom;
import one.stand.request.live.ShortVideoDataForm;
import one.stand.request.live.ShortVideoForm;
import one.stand.request.live.ShortVideoQuery;
import one.stand.request.live.SwitchVideoForm;
import one.stand.response.live.ShortVideoResponse;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 短视频业务
 * @author luoyang
 * @date 2020/5/20 11:56
 */
@Slf4j
@RestController
@RequestMapping("crmPc/shortVideo")
@Api(description = "短视频业务",tags="短视频管理")
public class ShortVideoController extends BaseController{

    /**
     * 添加短视频
     * @param request
     * @return
     */
    @PostMapping("add")
    @ApiController(isLogin = true, company = true,card = true,paramClass = ShortVideoForm.class)
    @ApiOperation(value = "添加短视频")
    public ResultModel<Boolean> add(@RequestAttribute  ShortVideoForm request){
        return crmFegin.addShortVideo(request);
    }

    /**
     * 更新
     * @param request
     * @return
     */
    @PostMapping("update")
    @ApiController(isLogin = true, company = true,card = true,paramClass = ShortVideoForm.class)
    @ApiOperation(value = "更新短视频")
    public ResultModel<Boolean> update(@RequestAttribute  ShortVideoForm request){
        return crmFegin.updateShortVideo(request);
    }

    /**
     * 更新视频浏览数据
     * @param request
     * @return
     */
    @PostMapping("updateData")
    @ApiController(isLogin = true, company = true,card = true,paramClass = ShortVideoDataForm.class)
    @ApiOperation(value = "更新视频浏览数据")
    public ResultModel<Boolean> updateData(@RequestAttribute ShortVideoDataForm request){
        return crmFegin.updateData(request);
    }

    /**
     * 查询
     * @param request
     * @return
     */
    @PostMapping("queryById")
    @ApiController(isLogin = true, company = true,card = true,paramClass = ShortVideoQuery.class)
    @ApiOperation(value = "查询短视频")
    public ResultModel<ShortVideoResponse> queryById(@RequestAttribute  ShortVideoQuery request){
        return crmFegin.queryShortVideoById(request);
    }

    /**
     * 删除
     * @param request
     * @return
     */
    @PostMapping("deleteById")
    @ApiController(isLogin = true, company = true,card = true,paramClass = ShortVideoQuery.class)
    @ApiOperation(value = "删除短视频")
    public ResultModel<Boolean> deleteById(@RequestAttribute  ShortVideoQuery request){
        return crmFegin.deleteShortVideoById(request);
    }


    /**
     * 分页查询
     * @param request
     * @return
     */
    @PostMapping("queryPage")
    @ApiController(isLogin = true, company = true,card = true,paramClass = ShortVideoQuery.class)
    @ApiOperation(value = "分页查询短视频")
    public ResultModel queryPage(@RequestAttribute  ShortVideoQuery request){
        return crmFegin.queryShortVideoByList(request);
    }

    @ApiController(isLogin = true, company = true,card = true,paramClass = SwitchVideoForm.class)
    @ApiOperation(value = "短视频开关")
    @PostMapping("switchVideo")
    public ResultModel<Boolean> switchVideo(@RequestAttribute  SwitchVideoForm request){
        return crmFegin.switchVideo(request);
    }
}
